<?php 
	// ********************************************************************
	
	function __autoload($class_name) {
	    require_once 'class.' . $class_name . '.php';
	}
	
	// ********************************************************************
	
/**
 * Clase abstracta Xtropy
 */
	abstract class Xtropy
	{
		public $config;

		
		// Force Extending class to define this method
	    abstract protected function getValue();
	    abstract protected function prefixValue($prefix);

		function __construct()
		{
			echo "Se construye ".get_class($this);
		}

		public function debug()
		{
		}


	    // Common method
	    public function printOut() {
	        print $this->getValue() . "\n";
	    }
	}
	
	// ********************************************************************

/**
 * clase App: Aplicacion concreta
 * 
 */
	class App extends Xtropy
	{
		protected function getValue() {
			return get_class($this);
		}
		public function prefixValue($prefix) {
			return "{$prefix}ConcreteClass1";
		}
		function __construct()
		{
			parent::__construct();			
			echo "<pre>";
			echo "Se construye ".get_class($this)."\n";
			echo "Métodos:\n";
			print_r(get_class_methods($this));
			echo "</pre>";
		}
	}

	// ********************************************************************

	define('APP_DIR', 'app');
	define('DS', DIRECTORY_SEPARATOR);
	define('ROOT', dirname(__FILE__));
	define('WEBROOT_DIR', 'webroot');
	define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);

	echo "<br>";
	echo APP_DIR."<br>";
	echo WWW_ROOT."<br>";

	$app = new App;
	$app->printOut();
	
	$window1 = new Window;

	echo "<pre>";
	Reflection::export(new ReflectionClass('Exception'));
	echo "</pre>";

	echo "<pre>";
	Reflection::export(new ReflectionClass('App'));
	echo "</pre>";





    /**
     * Another test function
     *
     * First parameter must be an array
     */
	function test_array(array $input_array) {
	    print_r($input_array);
	}

	test_array(1.5);


	/**
	 * contador() : Función Contador
	 * 
	 * @return $c++;
	 */
	function contador()
	{
		static $c = 0;
		return $c++;
	}


	$func = new ReflectionFunction('contador');

	echo "<pre>";
	printf(
	    "===> La función %s '%s'\n".
	    "     está declarada en %s\n".
	    "     (desde línea %d hasta %d)\n",
	    $func->isInternal() ? 'internal' : 'user-defined',
	    $func->getName(),
	    $func->getFileName(),
	    $func->getStartLine(),
	    $func->getEndline()
	);

	// Invoke the function
	printf("---> Invokation results in: ");
	var_dump($func->invoke());

	// you may prefer to use the export() method
	echo "\nReflectionFunction::export() results:\n";
	echo ReflectionFunction::export('contador');

?>